package controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;

@Controller
public class BaseController {
	protected UserDetails getUserDetails(){
		return (UserDetails) SecurityContextHolder.getContext()
	     .getAuthentication()
	     .getPrincipal();
	}
	
	protected String getUserName() {
		return getUserDetails().getUsername();
	}
}
